var Schema = mongoose.Schema;

/*
 *  ===================================圈子 Group Schema定义======================
 */

var groupMongoSchema = new Schema({
    createdBy: {type: Schema.Types.ObjectId, ref: 'user'},
    community: {type: Schema.Types.ObjectId, ref: 'community'},
    city: {type: Schema.Types.ObjectId, ref: 'masterData_Regions'},
    groupName: String,
    members: [
        {
            user: {type: Schema.Types.ObjectId, ref: 'user'},
            status: Number,                                       //0,邀请中 1,已邀请 2,已拒绝
            joinDate: {type: Date, default: Date.now},
            dateCreated: {type: Date, default: Date.now}
        }
    ],
    isValid: {type: Boolean, default: true},
    dateCreated: {type: Date, default: Date.now}
});

mongoose.model('group_family', groupMongoSchema, 'group_family');
